<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>四则运算</title>
    <script>
        function op(){
            let op = document.getElementById("op").value;
            let a = document.getElementById("a").value;
            let b = document.getElementById("b").value;
            a = parseInt(a);
            b = parseInt(b);
            console.log(op,a,b);

            let answer = 0;
            switch (op){
                case "jia":
                    answer = a + b; break;
                case "jian":
                    answer = a - b; break;
                case "cheng":
                    answer = a * b; break;
                case "chu":
                    answer = a / b; break;
            }
            document.getElementById("answer").value = answer;
        }
    </script>
</head>
<body>
    <input id="a"/>
    <select id="op">
        <option value="jia">+</option>
        <option value="jian">-</option>
        <option value="cheng">*</option>
        <option value="chu">/</option>
    </select>
    <input id="b"/> = <input id="answer" readonly/><br/>

    <button onclick="op()">计算</button>
</body>
</html>